﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;

namespace iReaper.IndexBuilder.WWESource
{
    [Serializable]
    public class ChannelInfo
    {
        [XmlArray("Items")]
        [XmlArrayItem("Item", typeof(ChannelInfoItem))]
        public ChannelInfoItem[] Items
        {
            get;
            set;
        }

        [XmlAttribute("name")]
        public string Name
        {
            get;
            set;
        }
    }

    [Serializable]
    public class ChannelInfoItem
    {
        public ChannelInfoItem()
        {
            Events = new List<EventItem>();
        }

        [XmlElement]
        public string Url
        {
            get;
            set;
        }

        [XmlElement]
        public string Category
        {
            get;
            set;
        }

        [XmlIgnore]
        public ChannelInfo Channel
        {
            get;
            set;
        }

        [XmlArray("Events")]
        [XmlArrayItem("Event", typeof(EventItem))]
        public List<EventItem> Events
        {
            get;
            set;
        }

    }

    [Serializable]
    public class EventItem
    {
        [XmlElement]
        public DateTime Publish
        {
            get;
            set;
        }

        [XmlElement]
        public string DownloadUrl
        {
            get;
            set;
        }

        [XmlElement]
        public string LiveMeetingUrl
        {
            get;
            set;
        }

        [XmlElement]
        public string Description
        {
            get;
            set;
        }

        [XmlElement]
        public string DetailUrl
        {
            get;
            set;
        }

        [XmlElement]
        public string Title
        {
            get;
            set;
        }

        [XmlArray]
        [XmlArrayItem("Author",typeof(Author))]
        public Author[] Authors
        {
            get;
            set;
        }
    }

    [Serializable]
    public class Author
    {

        [XmlElement]
        public string Name
        {
            get;
            set;
        }

        [XmlElement]
        public string Title
        {
            get;
            set;
        }

        [XmlElement]
        public string Introduce
        {
            get;
            set;
        }
    }
}
